﻿using System.Collections.ObjectModel;

namespace movie.tool.module.film.model
{
    /// <summary>
    /// 线索的组
    /// </summary>
    public class ClueCardGroupConfig : ClueCardGroupParam
    {
        private long id;
        /// <summary>
        /// 分组id
        /// </summary>
        public long Id {
            get => id;
            set
            {
                id = value;
                SendPropertyChanged(nameof(Id));
            }
        }

        /// <summary>
        /// 分组下的线索
        /// </summary>
        private ObservableCollection<ClueCardConfig> clueCards;
        public ObservableCollection<ClueCardConfig> ClueCards
        {
            get => clueCards;
            set
            {
                clueCards = value;
                SendPropertyChanged(nameof(ClueCards));
            }
        }

        public ClueCardConfig FindClueCard(string name)
        {
            if(ClueCards == null || ClueCards.Count == 0)
            {
                return null;
            }
            foreach(ClueCardConfig item in ClueCards)
            {
                if (Equals(item.Name, name))
                {
                    return item;
                }
            }
            return null;
        }

        public void NotifyScenesChanged()
        {
            SendPropertyChanged(nameof(Scenes));
        }
    }
}
